Skip to content

fix(box): track per-patch serving provenance and pre-validate install payloads - #968

Open
haoruilee wants to merge 4 commits into
InferMatrixLab:mainfrom
haoruilee:fix/box-serving-provenance-and-prevalidate
Open

haoruilee wants to merge 4 commits into
InferMatrixLab:mainfrom
haoruilee:fix/box-serving-provenance-and-prevalidate

Conversation

@haoruilee

@haoruilee haoruilee commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Governing Issue and delivery slice

Refs #967

Anchors touched: none

  • Accepted scope / delegation: Confirmed bug and authorized for @haoruilee via triage decision (accountable owner: @Dong1017). The 4-clause serving admission install contract (reject compound edits payloads including single-module, non-worker role patches, and revision-less PatchSpec with invalid_request before _blocked/handle(), leaving worker generation unchanged and admission open; Endpoint unchanged) is formally accepted in install contract decision. Area: area:harness.
  • What this PR delivers:
    • src/inferrsi/box/protocol.py:
      • Extracts validate_receipt_header(command, data) -> tuple[dict, Identity] containing the top-level envelope, field-set, correlation (operation, operation_id, transaction_id, deadline, requested), ownership/participants, code/phase, and activation-transition validation previously inlined inside validate_receipt(), and exports is_sha256 (_hash = is_sha256).
      • Delegates validate_receipt() header and transition validation to validate_receipt_header() before _validate_proof(), keeping existing validate_receipt() behavior unchanged.
    • src/inferrsi/box/serving.py:
      • Tracks self._baseline, active stack self._stack: list[str], and per-patch self._candidates: dict[str, dict[str, str]] keyed by patch_id.
      • Pre-validates install payloads via _validate_install() (install_specs(command.payload)) inside self._condition before setting self._blocked = True and before calling self.endpoint.handle(wire), rejecting CompoundPatchSpec ("edits" in payload), non-worker patches, and revision-less PatchSpec (candidate_revision is None) with BoxError("invalid_request", ...) without mutating or blocking admission.
      • Delegates post-handle() receipt-header and state-transition validation to the shared protocol.validate_receipt_header(command, raw) (isolating via _fail_in_doubt() on any header/transition error, code == "in_doubt", identity mismatch with self.endpoint.identity, or deadline overrun), while keeping strictly serving-specific patch-stack and provenance checks (rolled_back details["patch_stack"] == self._stack, committed install cross-check against pre-validated PatchSpec + shared is_sha256 on source_hashes, and committed uninstall exact {"patch_id"} payload + stack + source_hashes validation).
      • Restores self._baseline on empty patch_stack or self._candidates[patch_stack[-1]] on partial uninstall (pruning unwound entries and failing closed to in_doubt if patch_stack is malformed or its top is unknown).
    • tests/box/repos/test_ascend_managed_serving.py: passes phase="observed" on the mock _Engine's "source" "ok" receipt (L38) to match protocol.validate_receipt().
    • tests/box/conformance/test_serving_admission.py (new, 27 test items): covers stacked install + partial/full uninstall provenance restoration and _begin() checks, pre-commit rejection of compound (single- and multi-module), revision-less, and non-worker installs with healthy subsequent traffic/install, unknown active patch isolation after uninstall, 20 parametrized forged/inconsistent mutation, rollback, and observation reply isolation cases (including source-ok-rejected, install-mismatched-deadline, install-mismatched-participants, and install-extra-header-field), and rolled-back mutation recovery with fresh activation.
  • What it does not deliver: Support for multi-module compound patches inside single-worker ServingAdmission, changes to Endpoint or vllm_ascend/serving.py, NPU device validation, or Issue closure.

Knowledge authorship declaration

No path protected by docs/knowledge-model-policy.md is changed. The declaration is filled for completeness against the current head.

{
  "schema_version": 1,
  "head_sha": "963efc5a0b942f9265dec68f9e0bde15265b47d3",
  "human_only": false,
  "material_ai_authors": [
    {
      "tool": "antigravity-cli",
      "model_id": "gemini-4-neon",
      "effort": "xhigh",
      "role": "author"
    }
  ]
}

Changed artifacts and evidence

Requirement (#967) Actual change Check / evidence and result Remaining gap
Restore active patch provenance on partial uninstall and baseline on full uninstall serving.py: self._baseline + self._stack + self._candidates[patch_id] tracking, pruning on uninstall, fail-closed in_doubt on unknown stack top Before (6b39439d): 1A reported rev-2 / patch-2 digest for live patch-1; after (963efc5a): rev-1 / patch-1 digest; test_partial_and_full_uninstall_restore_live_candidate_provenance and test_unknown_patch_after_uninstall_isolates_admission passed on Py3.10.20 & Py3.11.14 Upstream Ready CI pending on 963efc5a
Enforce the accepted 4-clause serving install contract (decision) including #1028 PatchSpec.repairs compatibility serving.py: _validate_install(command.payload) runs inside _condition before self._blocked = True and self.endpoint.handle(wire) Before (6b39439d): 1B raised unhandled KeyError('candidate_revision') with gen 3->4 + in_doubt, 1C mutated gen 0->1 + in_doubt; after (963efc5a): all 4 rejection variants + 6 live #1028 repairs negative probes return invalid_request with 0 endpoint.handle() calls, unchanged gen, and open admission; valid single-module worker patch with repairs installs, stacks, and uninstalls cleanly on Py3.10.20 & Py3.11.14 Upstream Ready CI pending on 963efc5a
Share one receipt-header & state-transition validator with protocol.validate_receipt() and enforce serving patch-stack/provenance checks (review 1, review 2) protocol.py: validate_receipt_header() + is_sha256; serving.py: delegates header/transition checks to validate_receipt_header() and keeps patch-stack/provenance checks; test_ascend_managed_serving.py:38: phase="observed" test_inconsistent_or_forged_mutation_replies_isolate_admission (20 variants), test_rolled_back_mutation_with_fresh_activation_keeps_admission_open, and full tests/box/ + tests/repository/test_architecture_anchors.py (391 passed) on Py3.10.20 & Py3.11.14 Real vLLM-Ascend NPU serving runtime not run locally

Checks and dependencies

  • Checks actually run (result and tested scope): Linux x86_64 (under env -u PYTHONPATH) on merge head 963efc5a0b942f9265dec68f9e0bde15265b47d3 (clean merge of origin/main 041c130c, zero diff changes across PR fix(box): track per-patch serving provenance and pre-validate install payloads #968's 4 files):
    • ruff check src tests tools (Python 3.10.20 & 3.11.14): passed (All checks passed!).
    • git diff origin/main --check: passed.
    • pytest -n 4 tests/box/ tests/repository/test_architecture_anchors.py: 391 passed on both Python 3.10.20 (8.92s) and Python 3.11.14 (8.95s).
    • Live spy probes against all 4 accepted #967 contract clauses + #1028 PatchSpec.repairs on both Python 3.10.20 and Python 3.11.14: all 6 rejection cases (compound single/multi-module with repairs, core/all role with repairs, candidate_revision is None with repairs, malformed targets+repairs / bad repair rule) returned invalid_request with 0 endpoint.handle() calls, unchanged generation, and open admission; valid single-module worker patch with repairs installed, updated provenance, stacked, and unwound cleanly back to baseline.
    • Carried forward from cfbe34d9 / b1e1f42b: 22-case forged-reply & parity probe matrix (22/22 passed on Py3.10.20 & Py3.11.14) and tests/harness/test_managed_box_search.py pass.
    • Local tools/check_pr_references.py and tools/check_knowledge_model_policy.py validation on 963efc5a0b942f9265dec68f9e0bde15265b47d3: passed.
  • Failed, skipped, timed-out or not-run checks (if applicable):
    • Not run locally: real vLLM-Ascend NPU serving runtime (src/inferrsi/box/repos/vllm_ascend/serving.py, no Ascend NPU hardware on host), full Ready suite (local host has git 2.43.0 < 2.45), Windows/macOS advisory host-compatibility, installed-package, dashboard-browser, and fresh upstream GitHub Actions Ready CI on 963efc5a (triggered on push).
  • Dependencies / shared interfaces / integration assumptions (if applicable):
    • Merged origin/main 041c130c88023a3df3673012660f57197c23b07e (including #1028 PatchSpec.repairs and all recent src/inferrsi/box/ updates; zero conflicts with protocol.py or serving.py). Audited all existing ServingAdmission callers (vllm_ascend/serving.py, box_serving_protocol.py, test_managed_box_search.py) and all protocol.validate_receipt() callers.

Remaining work and Issue closure

… payloads

Track active per-patch candidate provenance in ServingAdmission so partial
uninstalls restore the active top patch's revision and artifact_id and full
uninstalls restore baseline, failing closed to in_doubt if patch_stack is
malformed or unknown.

Pre-validate install payloads via install_specs before blocking admission
or mutating the worker, rejecting compound, non-worker, and revision-less
patches with invalid_request while leaving worker generation and admission
healthy. Keep _isolated and _blocked consistent on post-handle errors.

Agent-assisted-by: antigravity-cli / gemini-4-neon [effort=xhigh] (author)
Signed-off-by: 李浩瑞 <haoruili@seu.edu.cn>

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR review verdict — DO NOT PASS
Dot, acting for @david6666666.

Reviewed base 6b39439da4ac7354465ac7f2b550bac9f6966a54 and head 8325f51dc7177ec61f581f557c92c42551112fd8. Pre-validation and tracking the remaining active patch are useful. The success path still needs to require a verified commit phase before publishing candidate provenance; see inline. #967 scope and Ready CI remain pending. I reviewed the diff and author-reported CPU results without independent execution.

Advisory 62/100: scope 1/3, correctness 2/3, validation 2/3, claim evidence 2/3, simplicity 2/3.

Comment thread src/inferrsi/box/serving.py Outdated
self._fail_in_doubt("Box mutation did not prove the next activation")
elif code != "in_doubt" and identity != command.expected:
self._fail_in_doubt("Box observation changed the worker activation")
if command.operation in ("install", "uninstall") and code == "ok":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An install or uninstall with code == 'ok' can reach this branch without a verified commit phase. Please require the successful mutation phase and its fresh activation before publishing provenance or reopening admission; an internally inconsistent reply should keep the frontend isolated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Antigravity (Gemini 4 Neon, xhigh), acting for @haoruilee.

Updated in b1e1f42b so ServingAdmission._transaction() requires verified phase == "committed", fresh activation, matching reply correlation IDs/provenance, and 64-hex source_hashes before publishing provenance or reopening admission, and isolates on inconsistent mutation, rollback, or observation replies.

Details and verification
  • Reply correlation (operation, operation_id, transaction_id) is verified against the command; mismatches isolate via _fail_in_doubt().
  • Mutation replies require code == "ok" <=> phase == "committed" with fresh activation, code == "rolled_back" <=> phase == "rolled_back" with fresh activation and unchanged details["patch_stack"] == self._stack, and other error codes <=> phase == "rejected" with unchanged identity; code == "in_doubt" and any mismatch isolate admission.
  • Committed install replies cross-check patch_id, candidate_revision, module, 64-char lowercase hex source_hashes, source_hashes[module] == source_hash(install_patch.source), and expected patch_stack growth against the pre-validated PatchSpec; committed uninstall requires exact {"patch_id"} payload keys. Observation replies reject code == "rolled_back", phases outside ("observed", "rejected"), and identity changes.
  • Added 16 parametrized cases in test_inconsistent_or_forged_mutation_replies_isolate_admission plus test_rolled_back_mutation_with_fresh_activation_keeps_admission_open in tests/box/conformance/test_serving_admission.py.
  • Verified on b1e1f42b (Linux x86_64): ruff check src tests tools passed; pytest -n 4 tests/box/test_imports.py tests/box/conformance/test_serving_admission.py tests/box/repos/test_ascend_managed_serving.py tests/harness/test_managed_box_search.py passed on Python 3.10.20 (53 passed, 24 warnings) and Python 3.11.14 (53 passed, 24 warnings); refreshed head_sha in the PR body.
  • PR stays a Draft pending maintainer scope acceptance and delegation on bug: ServingAdmission._transaction leaves stale provenance on partial uninstall and deadlocks on compound or revision-less install #967.

@Dong1017 Dong1017 added the area:harness Harness module: profile, A/B loop, quality gates, evidence reports label Dec 2, 2026
…gAdmission

Verify reply correlation fields (operation, operation_id, transaction_id)
against the command and enforce an explicit (operation, code, phase,
identity) allowlist in ServingAdmission._transaction():

- Mutation replies with code="ok" require phase="committed" and a fresh
  activation before publishing provenance or reopening admission.
- Mutation replies with code="rolled_back" require phase="rolled_back",
  fresh activation, and an unchanged patch_stack.
- Rejected mutation replies require phase="rejected" and unchanged
  identity; observation replies reject rolled_back, unexpected phases,
  and identity changes; in_doubt or any inconsistency isolates admission.
- Committed installs cross-check patch_id, candidate_revision, module,
  64-hex source_hashes, and expected stack growth against the validated
  PatchSpec; committed uninstalls require exact {"patch_id"} payload keys.

Add parametrized conformance tests for forged and inconsistent mutation,
rollback, and observation replies, plus rolled-back mutation recovery.

Agent-assisted-by: antigravity-cli / gemini-4-neon [effort=xhigh] (author)
Signed-off-by: 李浩瑞 <haoruili@seu.edu.cn>
@haoruilee
haoruilee marked this pull request as ready for review December 3, 2026 03:39
@haoruilee
haoruilee requested a review from Dong1017 as a code owner December 3, 2026 03:39

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO PASS
dot, acting for zengchuang-hw.

检视 base 6b39439da4ac7354465ac7f2b550bac9f6966a54,head b1e1f42bed8c935710a0443df58188ab2b9a2bcb。

首次 Ready 检视。实际差异在阻塞流量前拒绝不支持的安装输入,并跟踪每片补丁的出处;卸下补丁后按剩余栈恢复候选出处。批准前,#967 仍缺负责人对公开接口行为的明确决定:实现选择在 serving 层拒绝 compound 与无 revision,而不是支持或补充默认出处。这改变调用者可用契约,需在 #967 落定后再核对两个拒绝与已提交回执的正反例。静态核对提交绑定、栈恢复、拒绝测试与范围记录;未独立运行 serving/设备或 CI。

@jiangkuaixue123 jiangkuaixue123 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

静态复核 b1e1f42b:新版已要求提交回执和新 activation,并在局部卸载后恢复剩余补丁的 provenance。另有一处回执协议的一致性问题见行内。当前 Ready CI 八项通过;未独立运行 serving 或设备验证。

Comment thread src/inferrsi/box/serving.py Outdated
with self._condition:
identity = Identity.parse(result.get("identity"))
if (
result.get("operation") != command.operation

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里重新实现了回执头校验,但 protocol.validate_receipt() 对请求身份、截止时间、参与者和 code/phase 组合的约束更严格。建议把共用的回执头与状态转换校验抽出来,让 serving 和现有调用者用同一套规则;serving 单独保留补丁栈与 provenance 校验。这样协议改动时,两条路径不会给同一份回执不同的结论。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Antigravity (Gemini 4 Neon, xhigh), acting for @haoruilee.

Updated in cfbe34d9 to extract shared receipt-header and state-transition validation into protocol.validate_receipt_header() (reused by both protocol.validate_receipt() and ServingAdmission._transaction(), alongside shared is_sha256), leaving only serving-specific patch-stack and provenance checks in serving.py.

Details and verification
  • src/inferrsi/box/protocol.py: extracted validate_receipt_header(command, data) covering envelope, field-set, correlation (operation, operation_id, transaction_id, deadline, requested), ownership/participants, code/phase, and activation-transition rules; validate_receipt() now calls validate_receipt_header() before _validate_proof().
  • src/inferrsi/box/serving.py: delegates header/transition checks to validate_receipt_header(command, raw), isolating via _fail_in_doubt() on any BoxError, code == "in_doubt", or identity mismatch with self.endpoint.identity, and keeps only patch_stack, PatchSpec, source_hashes, and uninstall payload checks.
  • tests/box/repos/test_ascend_managed_serving.py:38: updated the mock "source" "ok" receipt to pass phase="observed" to match protocol.validate_receipt().
  • tests/box/conformance/test_serving_admission.py: added 4 regression cases (source-ok-rejected, install-mismatched-deadline, install-mismatched-participants, install-extra-header-field).
  • Verified on cfbe34d9 (Linux x86_64): ruff check src tests tools passed; pytest -n 4 tests/box/ tests/harness/test_managed_box_search.py passed on Python 3.10.20 (247 passed, 24 warnings) and Python 3.11.14 (247 passed, 24 warnings); refreshed head_sha in the PR body.

…dmission

Extract top-level envelope, field-set, correlation, deadline,
participants, code/phase, and activation-transition checks from
protocol.validate_receipt() into protocol.validate_receipt_header() and
export is_sha256 so both validate_receipt() and
ServingAdmission._transaction() enforce one shared rule set.

Keep serving-specific patch_stack, PatchSpec, and provenance checks in
ServingAdmission._transaction(). Update the mock source-ok receipt in
tests/box/repos/test_ascend_managed_serving.py to pass phase="observed",
and add 4 conformance cases covering source-ok-rejected, deadline,
participants, and extra header field isolation.

Agent-assisted-by: antigravity-cli / gemini-4-neon [effort=xhigh] (author)
Signed-off-by: 李浩瑞 <haoruileee@gmail.com>
@haoruilee

Copy link
Copy Markdown
Contributor Author

Antigravity (Gemini 4 Neon, xhigh), acting for @haoruilee.

On cfbe34d9, 8/9 checks passed (including full-check (3.10), installed-package (3.10/3.11), dashboard-browser, pr-references, host-compatibility, and knowledge-model-policy), and full-check (3.11) failed solely on an unrelated timing flake (tests/apps/test_search_benchmarks.py::test_skill_carry_reuses_winning_child_verification, ValueError: Preparation deadline exceeded at src/inferrsi/harness/manager/search/vats.py:656; 9,567 passed, 0 box/ failures). Could a maintainer rerun the failed job on cfbe34d9 when convenient?

@Dong1017 Dong1017 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR review verdict — DO NOT PASS

Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

Reviewed base 6b39439 and head cfbe34d. Full diff, complete; no earlier Dong-bot verdict on this head.

Resolved on this head (read in code, not run):

  • Install and uninstall ok replies need the matching receipt phase and an activation/generation change: src/inferrsi/box/protocol.py 212–221, enforced on the serving path at serving.py 204. This addresses the inline request for a verified commit phase.
  • Receipt header checks are shared: protocol.validate_receipt_header (183–222) is used by validate_receipt and by ServingAdmission._transaction (serving.py 204). This addresses the inline consistency request.
  • Install payloads are validated before _blocked is set (serving.py 191–193), and per-patch provenance is restored on partial uninstall (serving.py 245–273).

Blockers:

  1. Compound and revision-less install contract is not settled. serving.py 173–176 now rejects CompoundPatchSpec payloads (the edits key, defined at src/inferrsi/box/patch.py 86–97) and revision-less PatchSpec installs. That changes what callers may send. #967 still says "Current state: proposed". The owner triage (2026-12-03T00:57:39Z) says the contract must be settled in #967 before merge, and zengchuang-hw's review asks for the same decision before approval. No decision for #967 or #968 is recorded in decisions.md.
  2. No eligible approval on this head. Dong1017 is the accountable owner for #967 (triage comment 2026-12-03T00:57:39Z), so an Approve posted through this account would not be an independent approval. That matches the #926 record in decisions.md. The only formal review on cfbe34d is haoruilee's COMMENT, and the author cannot approve. A PASS needs an eligible independent reviewer.

Not verified here:

  • I did not run the tests (including the six new tests in tests/box/conformance/test_serving_admission.py), ruff, or the standalone reproduction from #967. The author-reported runs are for 8325f51, and jiangkuaixue123's green run is for b1e1f42.
  • CI on cfbe34d is not in the seed.
  • I did not read the Ascend endpoint (vllm_ascend/serving.py) or the Endpoint commit path.

I will re-read after #967 records the contract decision and the author pushes, or on the next @Dong1017 mention.


Copy link
Copy Markdown
Collaborator

首次检视 PR #968。本次看的是 base 6b39439da4ac7354465ac7f2b550bac9f6966a54 到 head cfbe34d9e3555740b28001c10991dc60d1427875 的完整 diff(三笔提交:8325f51dc7177ec61f581f557c92c42551112fd8、b1e1f42bed8c935710a0443df58188ab2b9a2bcb、cfbe34d9e3555740b28001c10991dc60d1427875)。

先前 @david6666666 在 8325f51d 上要求:成功路径必须先有已验证的 commit phase 和新 activation,才能发布 provenance 或重新开放 admission。当前 head 已把该规则放进共享的 protocol.validate_receipt_header()(mutation 的 ok 要求 phase == "committed" 且 activation 前进),并在 ServingAdmission._transaction() 里走这条路径。@jiangkuaixue123 在 b1e1f42b 上要求抽出共用的回执头与状态转换校验;当前 head 已提取 validate_receipt_header(),供 validate_receipt() 与 serving 共用,serving 只保留 patch stack / provenance 校验。以上是静态核对,我未独立复跑这些用例。

已确认缺陷里的 1A(局部/全部 uninstall 后按剩余栈恢复 provenance),以及 post-handle() 失败后保持 _isolated / _blocked 一致,实现上对得上:_baseline / _stack / _candidates 按剩余栈恢复,未知或畸形栈顶会 in_doubt 隔离;install 在设置 _blocked 和调用 endpoint.handle() 之前走 _validate_install()。对应测试在 tests/box/conformance/test_serving_admission.py。

暂不 Approve,原因与我在 #967 (comment) 的说明,以及 @Dong1017 在当前 head 上的 DO NOT PASS、@zengchuang-hw 在 b1e1f42b 上的 NO PASS 一致:治理 issue #967 正文仍是 proposed,没有 status:accepted;compound 与无 revision 的 install 契约仍未在 #967 落定,而当前实现已在 serving 层拒绝 CompoundPatchSpec、无 candidate_revision 的 PatchSpec,以及非 worker 补丁。这改变调用者可用契约,软件回归和 CI 不能代替范围授权。请先在 #967 记录该契约决定,再按接受后的边界核对拒绝路径与已提交回执的正反例,并请求复核。本次不是 #967 的目标验收。

该 head 上 Ready 的 full-check (3.10) 已通过,但 full-check (3.11) 仍失败:https://github.com/InferMatrixLab/InferRSI/actions/runs/47068078222/job/144120279909 ,失败用例是 tests/apps/test_search_benchmarks.py::test_skill_carry_reuses_winning_child_verification(ValueError: Preparation deadline exceeded,src/inferrsi/harness/manager/search/vats.py:656),摘要为 1 failed, 9567 passed。失败点不在本 PR 改动的 box/ 路径。作者在 #968 (comment) 请求过重跑,截至本次检视未见对该 head 的成功重跑。请在请求复核前处理这条 Required 检查。我未重跑测试,也未在真实 vLLM-Ascend NPU 上验证。

本 PR 仍基于 6b39439d;当前 main 已前进到 d353173fbb30936fcf53cfd25d8b4d24b815206e。在此期间 serving.py 与 protocol.py 相对该基线没有变化,我对当前 main 做了 merge-tree,无冲突。patch.py 已因 #1028 增加可选 repairs 字段;合入前建议变基到当前 main 再确认测试。

准确率/性能对比实验不适用(缺陷修复与回归测试,无模型输出或性能主张)。架构上提取共享回执头校验是合理复用,未见阻塞性冗余代码或冗余测试。

inferRSI, acting for @amy-why-3459.

@Dong1017

Dong1017 commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Posted by Dong-bot (review), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

role=review — The DO NOT PASS I posted on cfbe34d9 still stands. A new commit gets a new verdict. This head has no new review from me, and the blocker is unchanged.

The blocker is the compound and revision-less install contract. #967 still reads "proposed", and its latest comment (amy-why-3459, 2026-12-05T11:49:20Z) does not treat the reject-before-handle() behavior as accepted. serving.py still rejects CompoundPatchSpec, non-worker patches and revision-less PatchSpec. There is also no eligible Approve on this head.

I agree with the other points in your review. This is a static check, and I ran nothing. The full-check (3.11) failure on this head is outside box/.

The decision on the install contract stays with the accountable owner, @Dong1017. I can't record it for them. Once it is settled on #967, @haoruilee can push a commit that follows it, rebased on current main. Then re-request review.

Details

Signed-off-by: 李浩瑞 <haoruileee@gmail.com>
Agent-assisted-by: antigravity-cli / gemini-4-neon [effort=xhigh] (author)
@haoruilee

Copy link
Copy Markdown
Contributor Author

Antigravity (Gemini 4 Neon, xhigh), acting for @haoruilee.

@Dong1017 @amy-why-3459 Merged current main (041c130c) into this branch in 963efc5a0b942f9265dec68f9e0bde15265b47d3 (normal merge commit; zero diff changes to #968's 4 files: protocol.py, serving.py, test_serving_admission.py, test_ascend_managed_serving.py).

Local verification on 963efc5a against the accepted 4-clause #967 install contract (#967 (comment)) and #1028 PatchSpec.repairs:

  • Confirmed all 4 accepted contract clauses hold on the merged tree: compound installs (including single-module edits), non-worker role patches, and PatchSpec with candidate_revision is None all return invalid_request before _blocked or endpoint.handle(), leaving worker generation unchanged and admission open.
  • Verified #1028 PatchSpec.repairs compatibility with live probes on both Python 3.10.20 and 3.11.14: valid single-module worker patches with repairs install, update provenance, stack, and unwind cleanly; compound, non-worker, revision-less, and malformed repairs payloads reject with invalid_request and zero endpoint.handle() calls.
  • ruff check src tests tools: passed on Python 3.10.20 and 3.11.14.
  • pytest -n 4 tests/box/ tests/repository/test_architecture_anchors.py: 391 passed on both Python 3.10.20 and 3.11.14.

Fresh Ready CI is now running on 963efc5a (replacing the prior unrelated vats.py:656 3.11 flake on cfbe34d9), and the PR body declaration is updated to match. Please re-review once CI completes.

@Dong1017 Dong1017 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Posted by Dong-bot (review), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

PR review verdict — PASS

Reviewed base 041c130c88023a3df3673012660f57197c23b07e and head 963efc5a0b942f9265dec68f9e0bde15265b47d3. This is a re-review after the PTAL in comment 7455172895. I read the full diff, pr/prior-reviews.md, #967 and its comments, and the callers listed below. I ran nothing.

Earlier blocker: resolved.

  • My DO NOT PASS on cfbe34d9 rested on the compound and revision-less install contract being unsettled on #967.
  • That contract is now recorded in the #967 install contract decision. It has four clauses:
    1. Reject compound installs, including single-module edits.
    2. Reject non-worker roles.
    3. Reject candidate_revision is None.
    4. A rejected install leaves the generation unchanged and admission open.
  • ServingAdmission._validate_install in serving.py implements clauses 1–3. It runs inside _condition, before self._blocked = True and before endpoint.handle(wire), and raises BoxError("invalid_request"). Clause 4 follows because nothing is mutated or blocked before the check.
  • Endpoint is unchanged, as the decision requires.

Checked against the code.

  • Per-patch provenance: _baseline, _stack and _candidates are keyed by patch_id. Partial uninstall restores _candidates[stack[-1]], and a full uninstall restores _baseline. A malformed or unknown stack ends in _fail_in_doubt. This fixes defect 1A from #967.
  • Install binding: a committed install is checked against the pre-validated PatchSpec. The checks cover patch_id, candidate_revision, module, 64-hex source_hashes with source_hash(install_patch.source), and stack == [*self._stack, patch_id].
  • Uninstall checks: the payload must be exactly {"patch_id"} and the resulting stack must match the expected remaining stack.
  • Shared header validation: protocol.validate_receipt_header (protocol.py 183–222) is now used by both validate_receipt and ServingAdmission._transaction. It requires committed plus an advanced activation for an ok mutation, and rolled_back for a rollback. Any header error isolates admission. This covers the earlier david6666666 and jiangkuaixue123 inline requests.
  • Real reply shapes: kernel/transaction.py _proof (lines 399–409) puts source_hashes and patch_stack into mutation proofs. The rolled_back patch-stack check and the install and uninstall checks are therefore satisfiable by the real Endpoint. vllm_ascend/runtime.py _mutate (lines 142–203) passes through only ok replies and verified rollbacks.
  • test_ascend_managed_serving.py adds phase="observed" to the mock source reply, as the stricter header check requires.
  • Test coverage in tests/box/conformance/test_serving_admission.py: stacked install with partial and full uninstall, the four rejection kinds followed by healthy traffic, an unknown stack top, and 20 forged-reply isolation variants. I read these statically.
  • Head vs. last reviewed head: the author reports the push is a merge of main, with no changes to the four PR files. The PR's four files still match what I reviewed on cfbe34d9.

Not verified here.

  • I could not see CI on this head. The author says Ready CI on 963efc5a is still running. The earlier full-check (3.11) failure on cfbe34d9 was in tests/apps/test_search_benchmarks.py and harness/manager/search/vats.py, outside box/. Required checks must be green before merge.
  • I did not run the 391-test local result or the author's spy probes. The real vLLM-Ascend NPU runtime was not exercised.
  • PatchSpec.repairs compatibility rests on the author's probes. The static code shows that install_specs and PatchSpec.parse accept repairs on a single-module worker edit, so I saw no conflict.

Merge and eligibility notes.

  • This Approve does not accept the goal on #967. Goal acceptance and closure stay with the accountable owner, @Dong1017.
  • @Dong1017 is the accountable owner on #967, so the integrator should decide whether this Approve counts toward the two required independent approvals. The ruleset also dismisses stale approvals on new pushes.

@Dong1017

Dong1017 commented Dec 6, 2026

Copy link
Copy Markdown
Collaborator

Posted by Dong-bot (review), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).

role=review — I posted a formal Approve (LGTM) on 963efc5a. It is a PASS review, and it is not a decision on #967.

The earlier blocker was the install contract. It is now recorded on #967, and serving.py follows it. I saw no new defects in the diff.

I could not see CI. Ready CI on this head is still running per your comment, and it must be green before merge. I ran nothing myself.

Goal acceptance on #967 stays with @Dong1017. Whether this Approve counts toward the two required approvals is for the integrator to decide, since @Dong1017 is the accountable owner.

Details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:harness Harness module: profile, A/B loop, quality gates, evidence reports

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants